# 贝尔实验室 Spring 官方推荐镜像 JDK下载地址 https://bell-sw.com/pages/downloads/
FROM bellsoft/liberica-openjdk-debian:17.0.11-cds

LABEL maintainer="sakura"

RUN mkdir -p /sakura/sandbox/logs \
    /sakura/sandbox/tempCode \
    /home/user/code \

WORKDIR /sakura/sandbox

ENV SERVER_PORT=9999 LANG=C.UTF-8 LC_ALL=C.UTF-8 JAVA_OPTS=""

EXPOSE ${SERVER_PORT}

ADD ./sakura-oj-sandbox.jar /sakura/sandbox/app.jar

# 使用 shell 形式执行命令，确保先切换目录
ENTRYPOINT ["sh", "-c", "cd /sakura/sandbox && java \
  -Dserver.port=${SERVER_PORT} \
  -XX:+HeapDumpOnOutOfMemoryError \
  -XX:+UseZGC \
  ${JAVA_OPTS} \
  -jar ./app.jar"]


